home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 15.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-02-04  |  5.5 KB  |  274 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. Type = strip(line)
  22. call close (TempFile)
  23. j=0
  24. TFrames = Frames
  25. if Field = 1 then TFrames = Frames*2
  26. do i = 1 to Frames
  27.     call open TempFile,"RAM:VFXNums",W
  28.     call writeln TempFile,right(i,5,'0')
  29.     call writeln TempFile,right(Frames,5,'0')
  30.     call close TempFile
  31.     f=0
  32.     Redraw Off
  33.     FieldSet = 0
  34.     if Padding ~= -1 & i = 1 then call PadIt(1)
  35.     call LoadB()
  36.     call LoadA()
  37.     j = j+ 1
  38.     call DoIt()
  39.     Redraw On
  40.     call SaveIt()
  41.         if Field = 1 then do
  42.             Redraw Off
  43.             FieldSet = 1
  44.             call LoadB()
  45.             call LoadA()
  46.             j = j + 1
  47.             call DoIt()
  48.             Redraw On
  49.             call SaveIt()
  50.             end 
  51.     if Padding ~= -1 & i = Frames then call PadIt(2)
  52.     end
  53.     if SaveType = 0 then do
  54.         if Padding = -1 then
  55.             call MakeIcon(SaveName,(Frames-10))
  56.         else
  57.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  58.         end
  59.     Undo On
  60. exit
  61.  
  62.  
  63. PadIt:
  64. arg PadNum
  65.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  66.         Undo On
  67.         exit
  68.         end
  69.          if PadNum = 1 then do
  70.        if IAType = 0 then do
  71.         do Pad = Padding to 1 by -1
  72.             LoadBuffer PicAName Force StartA-(Pad-1)
  73.             call Switcher(TOSW)
  74.             call Switcher(MDV1)
  75.             Render Go
  76.                 call RecordAdd(SaveName,2,6,Compression)
  77.             end
  78.         end
  79.        if IAType = 1 then do
  80.         LoadBuffer PicAName Force 1
  81.         call Switcher(TOSW)
  82.         call Switcher(MDV1)
  83.         Render Go
  84.             call RecordAdd(SaveName,2*Padding,6,Compression)
  85.         end
  86.        if IAType = 2 then do
  87.         LoadBuffer PicAName Force
  88.         call Switcher(TOSW)
  89.         call Switcher(MDV1)
  90.         Render Go
  91.             call RecordAdd(SaveName,2*Padding,6,Compression)
  92.         end
  93.        if IAType = 3 then do
  94.         do Pad = Padding to 1 by -1
  95.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  96.             call Switcher(TOSW)
  97.             call Switcher(MDV1)
  98.             Render Go
  99.                 call RecordAdd(SaveName,2,6,Compression)
  100.             end
  101.         end
  102.     end 
  103.     else do
  104.        if IBType = 0 then do
  105.         do Pad = 1 to Padding
  106.             LoadBuffer PicBName Force StartB+Pad+Frames
  107.             call Switcher(TOSW)
  108.             call Switcher(MDV1)
  109.             Render Go
  110.                 call RecordAdd(SaveName,2,6,Compression)
  111.             end
  112.         end
  113.        if IBType = 1 then do
  114.         LoadBuffer PicBName Force 1
  115.         call Switcher(TOSW)
  116.         call Switcher(MDV1)
  117.         Render Go
  118.             call RecordAdd(SaveName,2*Padding,6,Compression)
  119.         end
  120.        if IBType = 2 then do
  121.         LoadBuffer PicBName Force
  122.         call Switcher(TOSW)
  123.         call Switcher(MDV1)
  124.         Render Go
  125.             call RecordAdd(SaveName,2*Padding,6,Compression)
  126.         end
  127.        if IBType = 3 then do
  128.         do Pad = 1 to Padding
  129.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  130.             call Switcher(TOSW)
  131.             call Switcher(MDV1)
  132.             Render Go
  133.                 call RecordAdd(SaveName,2,6,Compression)
  134.             end
  135.         end
  136.     end
  137. return
  138.  
  139.  
  140. LoadA:
  141.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  142.         Undo On
  143.         exit
  144.         end
  145.     if j = TFrames then return
  146.     if IAType = 0 then do
  147.         LoadBuffer PicAName Force i+StartA
  148.         end
  149.     if IAType = 1 then do
  150.         LoadBuffer PicAName Force 1
  151.         end
  152.     if IAType = 2 then do
  153.         LoadBuffer PicAName Force
  154.         end
  155.     if IAType = 3 then do
  156.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  157.         end
  158.  
  159. return
  160.  
  161. LoadB:
  162.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  163.         Undo On
  164.         exit
  165.         end
  166.     if j = 1 then return
  167.     if j < TFrames/2 then return
  168.     if IBType = 0 then do
  169.         LoadBuffer PicBName Force i+StartB
  170.         end
  171.     if IBType = 1 then do
  172.         LoadBuffer PicBName Force 1
  173.         end
  174.     if IBType = 2 then do
  175.         LoadBuffer PicBName Force
  176.         end
  177.     if IBType = 3 then do
  178.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  179.         end
  180.     Swap
  181. return
  182.  
  183.  
  184. DoIt:
  185.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  186.         Undo On
  187.         exit
  188.         end
  189.     if j = TFrames then do
  190.         Swap
  191.         return
  192.         end
  193.     if j = 1 then do
  194.         GetMain
  195.         parse var result Name Width Height Blah
  196.         return
  197.         end
  198.  
  199.     ByNum = 400
  200.     NewNum = ((j-1)*ByNum)/((TFrames/2)-1)
  201.     NewNum1 = trunc(NewNum)
  202.  
  203.     ByNum = Height-(Height/4)
  204.     if j > (TFrames/2) then 
  205.         NewNum3 = trunc(((ByNum -(((j-1) * ByNum)/(TFrames-1)))%1)*2)
  206.  
  207.     PerNum = (((j-1) * 720)/(TFrames-1))
  208.     PerNum = trunc(PerNum-480)
  209.     PerNum = -PerNum
  210.  
  211.     MainNum = 720
  212.     Num = (((j-1) * MainNum)/(TFrames-1))
  213.     NewNum2 = trunc(Num)
  214.     if Type = 1 then NewNum2 = -NewNum2
  215.     Hook Swirl NewNum2 0 0 0 0 0 Width/2 Height/2 NewNum1 0 0 Stretch AntiAlias
  216.     if j > (TFrames/2) then do
  217.         if PerNum < 0 then
  218.             Hook Perspective '0' '0' '0' '0' '0' PerNum '0' '0' -1 -1 -1 0 Black AntiAlias
  219.         AlphaChannel Off
  220.         Buffer2Alpha
  221.         SwapAlpha
  222.         Clearbuffer Force 0 0 0
  223.         EdgeMode FeatherOut 3
  224.         FilledOval Width/2 Height/2 NewNum3 NewNum3
  225.         Negative
  226.         EdgeMode Normal
  227.         SwapAlpha
  228.         AlphaChannel FRISKET
  229.         Merge 100 Alpha
  230.         AlphaChannel Off
  231.         end
  232. return
  233.  
  234. SaveIt:
  235.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  236.         Undo On
  237.         exit
  238.         end
  239.     if SaveType = 0 then do
  240.         call Switcher(TOSW)
  241.         call Switcher(MDV1)
  242.  
  243.         Render Go
  244.         if Field = 1 then
  245.                 call RecordAdd(SaveName,1,6,Compression)
  246.         else
  247.                 call RecordAdd(SaveName,2,6,Compression)
  248.         end
  249.  
  250.     if SaveType = 1 then do
  251.         if Field = 1 then do
  252.             f= f + 1
  253.             if f = 1 then
  254.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  255.             if f = 2 then do
  256.                 GetMain
  257.                 parse var result Name Width Height Blah
  258.                 Scale Width Height/2
  259.                 Swap
  260.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  261.                 Scale Width Height/2
  262.                 Hook Interlace
  263.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  264.                 f = 0
  265.                 end
  266.             end
  267.         else do
  268.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  269.             end    
  270.         end
  271. return
  272.  
  273.  
  274.